package com.dajie.pt.model;

import java.util.Date;

import com.dajie.common.util.StringUtil;
import com.dajie.pt.entity.base.BaseEntity;
import com.dajie.pt.utils.Weight;

/**
 * 
 * @author panbing.wu
 * 
 */
public class PracticeInfo extends BaseEntity
{

	private static final long serialVersionUID = -8507319804151578089L;

	@Weight(value = 60)
	private String corpName;

	@Weight(value = 60)
	private String position;

	@Weight(value = 20)
	private Integer positionIndustry;

	@Weight(value = 60)
	private Integer positionFunction;

	@Weight(value = 60)
	private Integer positionExperience;

	@Weight(value = 10)
	private Date startDate;

	@Weight(value = 10)
	private Date endDate;

	@Weight(value = 20)
	private String desc;

	public PracticeInfo()
	{
	}

	public PracticeInfo(String corpName, String position, Integer industry, Integer function, Integer experience,
			Date startDate, Date endDate, String desc)
	{
		this.corpName = corpName;
		this.position = position;
		this.positionIndustry = industry;
		this.positionFunction = function;
		this.positionExperience = experience;
		this.startDate = startDate;
		this.endDate = endDate;
		this.desc = desc;
	}

	public String getDesc()
	{
		return desc;
	}

	public void setDesc(String desc)
	{
		this.desc = desc;
	}

	public String getCorpName()
	{
		return corpName;
	}

	public void setCorpName(String corpName)
	{
		this.corpName = corpName;
	}

	public String getPosition()
	{
		return position;
	}

	public void setPosition(String position)
	{
		this.position = position;
	}

	public Integer getPositionIndustry()
	{
		return positionIndustry;
	}

	public void setPositionIndustry(Integer positionIndustry)
	{
		this.positionIndustry = positionIndustry;
	}

	public Integer getPositionFunction()
	{
		return positionFunction;
	}

	public void setPositionFunction(Integer positionFunction)
	{
		this.positionFunction = positionFunction;
	}

	public Integer getPositionExperience()
	{
		return positionExperience;
	}

	public void setPositionExperience(Integer positionExperience)
	{
		this.positionExperience = positionExperience;
	}

	public Date getStartDate()
	{
		return startDate;
	}

	public Date getEndDate()
	{
		return endDate;
	}

	public void setEndDate(Object endDate)
	{
		this.endDate = castToDate(endDate);
	}

	public void setStartDate(Object startDate)
	{
		this.startDate = castToDate(startDate);
	}

	@Override
	public boolean equals(Object obj)
	{
		if (obj instanceof PracticeInfo)
		{
			PracticeInfo pinfo = (PracticeInfo) obj;
			if ((pinfo.getCorpName() == this.corpName || (pinfo.getCorpName() != null && pinfo
					.getCorpName().equals(this.getCorpName())))
					&& (pinfo.getPosition() == this.position || ( pinfo.getPosition() != null && pinfo
							.getPosition().equals(this.getPosition())))
					&& (pinfo.getPositionIndustry() == this.positionIndustry || (pinfo.getPositionIndustry() != null && pinfo
							.getPositionIndustry().equals(this.getPositionIndustry())))
					&& (pinfo.getPositionFunction() == this.positionFunction || (pinfo.getPositionFunction() != null && pinfo
							.getPositionFunction().equals(this.getPositionFunction())))
					&& (pinfo.getPositionExperience() == this.positionExperience || (pinfo.getPositionExperience() != null && pinfo
							.getPositionExperience().equals(this.getPositionExperience())))
					&& (pinfo.getStartDate() == this.startDate || (pinfo.getStartDate() != null && pinfo.getStartDate()
							.equals(this.getStartDate())))
					&& (pinfo.getEndDate() == this.endDate || (pinfo.getEndDate() != null && pinfo.getEndDate().equals(
							this.getEndDate())))
					&& (pinfo.getDesc() == this.desc || (pinfo.getDesc() != null && pinfo.getDesc()
							.equals(this.getDesc()))))
			{
				return true;
			}
		}
		return false;
	}
}
